{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
{/block}
{block name="body"}
<div class="main-box no-header clearfix">
	
	<div class="main-box-body clearfix">
		<div class="row">
			<form method="get">
				<div class="col-sm-12 col-md-1 col-lg-1">
					<select name="status" id="status" class="form-control">
						<option value="">状态</option>
						<option value="0" 
						{eq name="status" value="0"}selected{/eq} >未提现</option>
						<option value="1" {eq name="status" value="1"}selected{/eq}>已打款
						</option>
						<option value="2" {eq name="status" value="2"}selected{/eq}>提现中
						</option>
					</select>
				</div>
				<div class="col-sm-12 col-md-2 col-lg-2">
					
					<div class="input-group">
						<input type="text" class="form-control" name="startdata" id="startdata" value="{$startdata|date='Y-m-d',###}" placeholder="">
						<span class="input-group-addon"><i class="fa fa-th"></i></span>
					</div>
				</div>
				<div class="col-sm-12 col-md-2 col-lg-2">
					<div class="input-group">
						<input type="text" class="form-control" name="enddata" id="enddata" value="{$enddata|date='Y-m-d',###}" placeholder="">
						<span class="input-group-addon"><i class="fa fa-th"></i></span>
					</div>
				</div>
				<div class="col-sm-12 col-md-1 col-lg-1">
					<select name="uid" id="uid" class="form-control">
						<option value="">用户名</option>
						{volist name="member" id="vo"}
						{if $vo.uid == $uid}
							<option value="{$vo.uid}" selected>{$vo.username}</option>
						{else /}
							<option value="{$vo.uid}">{$vo.username}</option>
						{/if}
						
						{/volist}
					</select>
				</div>
							
				<div class="col-sm-12 col-md-1">
					<button class="btn btn-primary" type="submit">搜索</button>
				</div>
				<span class="col-sm-12 col-md-3" style="display: inline-block;vertical-align: bottom;margin-left:10px;">
					<a href="{:url('agent',array('startdata'=>$yesterday,'enddata'=>$yesterday))}"
						>昨天
					</a>
					|
					<a href="{:url('agent',array('startdata'=>$beforeday,'enddata'=>$beforeday))}">
						前天
					</a>
					|
					<a href="{:url('agent',array('startdata'=>$weekstart,'enddata'=>$today))}">
						最近7天
					</a>
				</span>
			</form>
		</div>
		<!-- 表格列表 -->

		<div class="tabs-wrapper" style="margin-top:20px;">
				<div class="tab-content">
				    <div class="tab-pane fade in active" id="tab订单统计">
					<div class="row">
						<div class="col-md-4">
							<div class="well">
								<b>充值总额</b>
								<div class="text-primary" style="font-size:32px;margin:5px 0">
									&yen;{$pay|number_format=###,2}                </div>
								<div style="font-size:14px" class="text-muted">
									充值笔数 <b class="text-warning">{$paynum}</b>
								</div>
							</div>
						</div>
						<div class="col-md-4">
							<div class="well">
								<b>结算总额</b>
								<div class="text-primary" style="font-size:32px;margin:5px 0">
									&yen;{$balmoney|number_format=###,2}                </div>
								<div style="font-size:14px;" class="text-muted">
									未提现 <b class="text-warning">&yen;{$wmoney|number_format=###,2}</b>,
									提现中 <b class="text-warning">&yen;{$zmoney|number_format=###,2}</b>,
									已打款 <b class="text-warning">&yen;{$ymoney|number_format=###,2}</b>
								</div>
							</div>
						</div>
						<div class="col-md-4">
							<div class="well">
								<b>利润</b>
								<div class="text-primary" style="font-size:32px;margin:5px 0">
									&yen;{$profit|number_format=###,2}               </div>
								<div style="font-size:14px" class="text-muted">
															进帐 <span class="text-warning">&yen;{$pay|number_format=###,2}</span>,
														成本 <span class="text-warning">&yen;{$cost|number_format=###,2}</span>
								</div>
							</div>
						</div>	
					</div>
					<ul class="nav nav-tabs">
						<li {if $type ==0}class="active"{/if}>
							<a href="{:url('agent',array('type'=>0))}">全部</a>
						</li>
						<li {if $type ==2}class="active"{/if}>
							<a href="{:url('agent',array('type'=>2))}">个人</a>
						</li>
						<li {if $type ==1}class="active"{/if}>
							<a href="{:url('agent',array('type'=>1))}">对公</a>
						</li>
					</ul>

					<table class="table table-striped table-bordered table-hover responsive">
						<thead>
						<tr>
							<td>
								日期
							</td>
							{if $Think.session.user_auth.group == 999}
							<td>
								名字
							</td>
							{/if}
							<td>
								总笔数
							</td>
							<td class="text-center">
								充值金额
							</td>
							<td class="text-center">
								应结算金额
							</td>
							{if $Think.session.user_auth.group == 999}
							<td class="text-center">
								支付信息
							</td>
							{/if}
							<td class="text-center">
								佣金比例
							</td>
							<td>
								状态
							</td>
						</tr>
						</thead>
						<tbody>
						{if condition="empty($list)"}
							<tr>
								<td colspan="6" align="center">暂无数据！</td>
							</tr>
						{else/}
							{volist name="list" id="item"}
								<tr>
									<td>
										<a href="{:url('cashdetail',array('id'=>$item.id))}">{$item.create_time|date='Y-m-d',###}</a>
									</td>
									{if $Think.session.user_auth.group == 999}
									<td>{$item.uid|get_username=###}</td>
									{/if}
									<td>{$item.num}</td>
									<td class="text-right">{$item.money|number_format=###,2}</td>
									<td class="text-right"><strong>{$item.balmoney|number_format=###,2}</strong></td>
									{if $Think.session.user_auth.group == 999}
									<td>{$item.uid|get_payinfo}</td>
									{/if}
									<td class="text-right">{$item.percentage}</td>
									<td>
										<a class="btn btn-xs btn-pending" href="{:url('cashdetail',array('id'=>$item.id))}">
										{switch $item.status}
											{case value="0"}未提现{/case}
											{case value="1"}已打款{/case}
											{case value="2"}提现中{/case}
										{/switch}             </a>
									</td>
								</tr>
							{/volist}
						{/if}
								</tbody>
					</table>
					{$page}
					</div>
				</div>
		</div>
		<!-- /表格列表 -->
	</div>
</div>
<!-- datepicker statr -->
<link href="/public/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
<script src="/public/plugs/datepicker/js/foundation-datepicker.js"></script>
<script src="/public/plugs/datepicker/js/foundation-datepicker.zh-CN.js"></script>
<script>
	$('#startdata').fdatepicker({
		format: 'yyyy-mm-dd'
	});
	$('#enddata').fdatepicker({
		format: 'yyyy-mm-dd'
	});
</script>

{/block}